<?php
namespace Cyfy\Modules\Locale;

class Locale{
    static $months = array(
        "en" => array(1=>"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
        "cs" => array(1=>"leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"),
    );
    
    static $daysShort = array(
        "en" => array(1=>"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"),
        "cs" => array(1=>"Ne", "Po", "Út", "St", "Čt", "Pá", "So")
    );
    
    static $days = array(
        "en" => array(1=>"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"),
        "cs" => array(1=>"Ne", "Po", "Út", "St", "Čt", "Pá", "So")
    );
    
    public static $dateTimeFormat = "Y-m-d H:i";
    public static $dateFormat = "Y-m-d";
    public static $timeFormat = "H:i";
    
    static function getCurrency($number, $currency = DEFAULT_CURRENCY)
    {
        
        switch($currency){
            case "CZK":
                return number_format($number, 2, ',', ' ') . " Kč";
                break;
            default:
                return;
        }
    }
    
    static function getTime($datetime, $omitZeros = false)
    {
        $dt = new \DateTime($datetime);
        
        // format to be used
        $use = self :: $dateTimeFormat;
        
        // omitting zeros
        if($omitZeros){
            if($dt -> format("Hi") == "0000"){
                $use = self :: $dateFormat;
            }
        }
        
        return $dt -> format($use);
    }
    
    static public function getMonth($id)
    {
        return self :: $months[\Cyfy\Language :: getActive()][$id];   
    }
    
    static public function getMonths()
    {
        return self :: $months[\Cyfy\Language :: getActive()];    
    }
    static public function getDays($short = false)
    {
        if($short)
        {
            return self :: $daysShort[\Cyfy\Language :: getActive()];    
        }

        return self :: $days[\Cyfy\Language :: getActive()];    
    }
    
    static public function getDatetimeFormat()
    {
        return self :: $dateTimeFormat;
    }
    
    
}
